<div class="layui-row layui-col-space15">
    <div class="layui-col-sm12">
        @if ($items)
        @foreach($items as $i => $item)
        <div class="layui-panel" style="padding:15px;">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-sm12">
                    <!-- 内容标题 -->
                    <div class="layui-row">
                        <div class="layui-col-sm12" style="text-align: center;">
                            <h1>{{$item->title}}</h1>
                        </div>
                    </div>
                    <br />
                    <!-- 元信息 -->
                    <div class="layui-row">
                        <div class="layui-col-sm12" style="border-bottom: 1px #eee solid;padding-bottom: 15px;">
                            @if ($item->cat_id)
                            <i class="layui-icon layui-icon-list"></i> <a href="{{$item->catLink}}" title="{{$item->catName}}">{{$item->catName}}</a>
                            @endif
                            &nbsp;&nbsp;&nbsp; <i class="layui-icon layui-icon-read"></i> {{$item->views}} 阅读
                            &nbsp;&nbsp;&nbsp; <i class="layui-icon layui-icon-reply-fill"></i> {{$item->comments}} 评论
                        </div>
                    </div>
                    <br />
                    <!-- 内容摘要 -->
                    @if ($item->excerpt)
                    <div class="layui-row">
                        <div class="layui-col-sm12" style="border: 1px #eee solid;padding: 15px;">
                            {{$item->excerpt}}
                        </div>
                    </div>
                    <br />
                    @endif
                    <!-- 内容主体 -->
                    <div class="layui-row">
                        <div class="layui-col-sm12">
                            {!!preg_replace('/<(img[^>]*)>/', '<$1 style="max-width: 100%">', $item->content)!!}
                        </div>
                    </div>
                    <br />
                    <!-- 内容申明 -->
                    @if (isset($setting->statement) && $setting->statement)
                    <div class="layui-row">
                        <div class="layui-col-sm12" style="border-bottom: 1px #eee solid;padding-bottom: 15px;">
                            {!!str_replace('{url}', url()->current(), $setting->statement)!!}
                        </div>
                    </div>
                    <br />
                    @endif
                    <!-- 内容标签 -->
                    @if ($item->tags)
                    <div class="layui-row">
                        <div class="layui-col-sm12">
                            <i class="layui-icon layui-icon-note"></i>
                            @foreach($item->tags as $t => $tag)
                            <a href="{{$tag['link']}}" title="{{$tag['name']}}" rel="nofollow">{{$tag['name']}}</a>{{$t !== count($item->tags) - 1 ? '，' : ''}}
                            @endforeach
                        </div>
                    </div>
                    <br />
                    @endif
                </div>
            </div>
        </div>
        @if ($i !== count($items) - 1)
        <br />
        @endif
        @endforeach
        @else
        <div class="layui-panel" style="padding:15px;text-align:center">暂无文章</div>
        @endif
    </div>
</div>
<br />
<!-- 相关文章 -->
@if (isset($related) && $related)
<div class="layui-row layui-col-space15">
    <div class="layui-col-md12">
        <div class="layui-card">
            <div class="layui-card-header">相关文章</div>
            <div class="layui-card-body">
                <div class="layui-row">
                    @foreach($related as $relate)
                    <div class="layui-col-md3">
                        <div class="layui-card" style="padding: 10px;">
                            <a href="{{$relate->link}}" title="{{$relate->title}}"><img src="{{$relate->thumb}}" alt="{{$relate->title}}" style="width:100%"></a>
                            <br />
                            <p><a href="{{$relate->link}}" title="{{$relate->title}}" rel="nofollow">{{$relate->title}}</a></p>
                        </div>
                    </div>
                    @endforeach
                </div>
            </div>
        </div>
    </div>
</div>
<br />
@endif
<!-- 评论留言 -->
<div class="layui-row layui-col-space15">
    <div class="layui-col-md12">
        <div class="layui-card">
            <div class="layui-card-header">发表评论</div>
            <div class="layui-card-body comment-area">
                <!-- 评论框 -->
                <div class="layui-row comment-form">
                    <div class="layui-col-md12" style="margin-top: 5px;">
                        <form class="layui-form layui-form-pane comment-form-data">
                            @csrf
                            @if (!isset($user->username))
                            <div class="layui-form-item">
                                <div class="layui-input-inline">
                                    <input type="name" name="name" lay-verify="required" placeholder="用户名" autocomplete="off" placeholder="游客" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">或 <a href="javascript:;" class="login">登录</a> 后评论</div>
                            </div>
                            @endif
                            <div class="layui-form-item layui-form-text">
                                <div class="layui-input-block">
                                    <textarea name="comment" lay-verify="required" placeholder="请输入" class="layui-textarea"></textarea>
                                </div>
                            </div>
                            <div class="layui-form-item" style="text-align: right;">
                                <i class="layui-hide layui-icon layui-icon-loading-1 layui-anim layui-anim-rotate layui-anim-loop"></i> <button type="button" class="layui-btn" lay-submit="" lay-filter="comment" data-post-id={{$article->id}}><i class="layui-icon layui-icon-release"></i> 发表评论</button>
                            </div>
                        </form>
                    </div>
                </div>
                <!-- 评论列表 -->
                {!!$comments!!}
                <div id="pages" style="text-align: center;"></div>
            </div>
        </div>
    </div>
</div>
<br />